home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / PInterfaces / Icons.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  8.2 KB  |  300 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Icons.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.     UNIT Icons;
  18.     INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingIcons}
  22. {$SETC UsingIcons := 1}
  23.  
  24. {$I+}
  25. {$SETC IconsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQuickDraw}
  31. {$I $$Shell(PInterfaces)QuickDraw.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := IconsIncludes}
  34.  
  35.  
  36.  
  37. CONST
  38.  
  39. { The following are icons for which there are both icon suites and SICNs. }
  40. genericDocumentIconResource = -4000;
  41. genericStationeryIconResource = -3985;
  42. genericEditionFileIconResource = -3989;
  43. genericApplicationIconResource = -3996;
  44. genericDeskAccessoryIconResource = -3991;
  45.  
  46. genericFolderIconResource = -3999;
  47. privateFolderIconResource = -3994;
  48.  
  49. floppyIconResource = -3998;
  50. trashIconResource = -3993;
  51.  
  52. { The following are icons for which there are SICNs only. }
  53. desktopIconResource = -3992;
  54. openFolderIconResource = -3997;
  55. genericHardDiskIconResource = -3995;
  56. genericFileServerIconResource = -3972;
  57. genericSuitcaseIconResource = -3970;
  58. genericMoverObjectIconResource = -3969;
  59.  
  60. { The following are icons for which there are icon suites only. }
  61. genericPreferencesIconResource = -3971;
  62. genericQueryDocumentIconResource = -16506;
  63. genericExtensionIconResource = -16415;
  64.  
  65. systemFolderIconResource = -3983;
  66. appleMenuFolderIconResource = -3982;
  67. startupFolderIconResource = -3981;
  68. ownedFolderIconResource = -3980;
  69. dropFolderIconResource = -3979;
  70. sharedFolderIconResource = -3978;
  71. mountedFolderIconResource = -3977;
  72. controlPanelFolderIconResource = -3976;
  73. printMonitorFolderIconResource = -3975;
  74. preferencesFolderIconResource = -3974;
  75. extensionsFolderIconResource = -3973;
  76.  
  77. fullTrashIconResource = -3984;
  78.  
  79. large1BitMask = 'ICN#';
  80. large4BitData = 'icl4';
  81. large8BitData = 'icl8';
  82. small1BitMask = 'ics#';
  83. small4BitData = 'ics4';
  84. small8BitData = 'ics8';
  85. mini1BitMask = 'icm#';
  86. mini4BitData = 'icm4';
  87. mini8BitData = 'icm8';
  88.  
  89.  
  90.     { IconAlignmentType values    }
  91. atNone                =    $0;
  92. atVerticalCenter    =    $1;
  93. atTop                =    $2;
  94. atBottom            =    $3;
  95. atHorizontalCenter    =    $4;
  96. atAbsoluteCenter    =    (atVerticalCenter + atHorizontalCenter);
  97. atCenterTop            =    (atTop + atHorizontalCenter);
  98. atCenterBottom        =    (atBottom + atHorizontalCenter);
  99. atLeft                =    $8;
  100. atCenterLeft        =    (atVerticalCenter + atLeft);
  101. atTopLeft            =    (atTop + atLeft);
  102. atBottomLeft        =    (atBottom + atLeft);
  103. atRight                =    $C;
  104. atCenterRight        =    (atVerticalCenter + atRight);
  105. atTopRight            =    (atTop + atRight);
  106. atBottomRight        =    (atBottom + atRight);
  107.  
  108.     { IconTransformType values }
  109. ttNone                =    $0;
  110. ttDisabled            =    $1;
  111. ttOffline            =    $2;
  112. ttOpen                =    $3;
  113. ttLabel1            =    $0100;
  114. ttLabel2            =    $0200;
  115. ttLabel3            =    $0300;
  116. ttLabel4            =    $0400;
  117. ttLabel5            =    $0500;
  118. ttLabel6            =    $0600;
  119. ttLabel7            =    $0700;
  120. ttSelected            =    $4000;
  121. ttSelectedDisabled    =    (ttSelected + ttDisabled);
  122. ttSelectedOffline    =    (ttSelected + ttOffline);
  123. ttSelectedOpen        =    (ttSelected + ttOpen);
  124.     
  125.     { IconSelectorValue masks }
  126. svLarge1Bit            =    $00000001;
  127. svLarge4Bit            =    $00000002;
  128. svLarge8Bit            =    $00000004;
  129. svSmall1Bit            =    $00000100;
  130. svSmall4Bit            =    $00000200;
  131. svSmall8Bit            =    $00000400;
  132. svMini1Bit            =    $00010000;
  133. svMini4Bit            =    $00020000;
  134. svMini8Bit            =    $00040000;
  135. svAllLargeData        =    $000000ff;
  136. svAllSmallData        =    $0000ff00;
  137. svAllMiniData        =    $00ff0000;
  138. svAll1BitData        =    (svLarge1Bit + svSmall1Bit + svMini1Bit);
  139. svAll4BitData        =    (svLarge4Bit + svSmall4Bit + svMini4Bit);
  140. svAll8BitData        =    (svLarge8Bit + svSmall8Bit + svMini8Bit);
  141. svAllAvailableData    =    $ffffffff;
  142.     
  143. TYPE
  144.     IconSelectorValue    =    LONGINT;
  145.     IconAlignmentType    =    INTEGER;
  146.     IconTransformType    =    INTEGER;
  147.  
  148.     IconAction            =    ProcPtr;    {
  149.                                             FUNCTION IconAction(theType: ResType;
  150.                                                         VAR theIcon: Handle;
  151.                                                         yourDataPtr: Ptr): OSErr;
  152.                                         }
  153.                                         
  154.     IconGetter            =    ProcPtr;    {
  155.                                             FUNCTION IconGetter(theType: ResType;
  156.                                                         yourDataPtr: Ptr): Handle;
  157.                                         }
  158.  
  159.  
  160.     FUNCTION PlotIconID(theRect: Rect;
  161.                         align: IconAlignmentType;
  162.                         transform: IconTransformType;
  163.                         theResID: INTEGER): OSErr;
  164.         INLINE    $303C, $0500, $ABC9;
  165.     
  166.     FUNCTION NewIconSuite(VAR theIconSuite: Handle): OSErr;
  167.         INLINE    $303C, $0207, $ABC9;
  168.     
  169.     FUNCTION AddIconToSuite(theIconData: Handle;
  170.                             theSuite: Handle;
  171.                             theType: ResType): OSErr;
  172.         INLINE    $303C, $0608, $ABC9;
  173.     
  174.     FUNCTION GetIconFromSuite(VAR theIconData: Handle;
  175.                             theSuite: Handle;
  176.                             theType: ResType): OSErr;
  177.         INLINE    $303C, $0609, $ABC9;
  178.     
  179.     FUNCTION ForEachIconDo(theSuite: Handle;
  180.                             selector: IconSelectorValue;
  181.                             action: IconAction;
  182.                             yourDataPtr: Ptr): OSErr;
  183.         INLINE    $303C, $080A, $ABC9;
  184.     
  185.     FUNCTION GetIconSuite(VAR theIconSuite: Handle;
  186.                             theResID: INTEGER;
  187.                             selector: IconSelectorValue): OSErr;
  188.         INLINE    $303C, $0501, $ABC9;
  189.     
  190.     FUNCTION DisposeIconSuite(theIconSuite: Handle;
  191.                             disposeData: BOOLEAN): OSErr;
  192.         INLINE    $303C, $0302, $ABC9;
  193.     
  194.     FUNCTION PlotIconSuite(theRect: Rect;
  195.                             align: IconAlignmentType;
  196.                             transform: IconTransformType;
  197.                             theIconSuite: Handle): OSErr;
  198.         INLINE    $303C, $0603, $ABC9;
  199.     
  200.     FUNCTION MakeIconCache(VAR theHandle: Handle;
  201.                             makeIcon: IconGetter;
  202.                             yourDataPtr: UNIV Ptr): OSErr;
  203.         INLINE    $303C, $0604, $ABC9;
  204.     
  205.     FUNCTION LoadIconCache(theRect: Rect;
  206.                             align: IconAlignmentType;
  207.                             transform: IconTransformType;
  208.                             theIconCache: Handle): OSErr;
  209.         INLINE    $303C, $0606, $ABC9;
  210.  
  211.     FUNCTION PlotIconMethod(theRect: Rect;
  212.                             align: IconAlignmentType;
  213.                             transform: IconTransformType;
  214.                             theMethod: IconGetter;
  215.                             yourDataPtr: UNIV Ptr): OSErr;
  216.         INLINE $303C, $0805, $ABC9;
  217.     
  218.     FUNCTION GetLabel(labelNumber: INTEGER; VAR labelColor: RGBColor;
  219.                             VAR labelString: Str255): OSErr;
  220.         INLINE $303C, $050B, $ABC9;
  221.     
  222.     FUNCTION PtInIconID(testPt: Point; iconRect: Rect;
  223.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  224.         INLINE $303C, $060D, $ABC9;
  225.  
  226.     FUNCTION PtInIconSuite(testPt: Point; iconRect: Rect;
  227.                     align: IconAlignmentType;
  228.                     theIconSuite: Handle): BOOLEAN;
  229.         INLINE $303C, $070E, $ABC9;
  230.  
  231.     FUNCTION PtInIconMethod(testPt: Point; iconRect: Rect;
  232.                     align: IconAlignmentType;
  233.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  234.         INLINE $303C, $090F, $ABC9;
  235.  
  236.     FUNCTION RectInIconID(testRect: Rect; iconRect: Rect;
  237.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  238.         INLINE $303C, $0610, $ABC9;
  239.  
  240.     FUNCTION RectInIconSuite(testRect: Rect; iconRect: Rect;
  241.                     align: IconAlignmentType;
  242.                     theIconSuite: Handle): BOOLEAN;
  243.         INLINE $303C, $0711, $ABC9;
  244.  
  245.     FUNCTION RectInIconMethod(testRect: Rect; iconRect: Rect;
  246.                     align: IconAlignmentType;
  247.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  248.         INLINE $303C, $0912, $ABC9;
  249.  
  250.     FUNCTION IconIDToRgn(theRgn: RgnHandle; iconRect: Rect;
  251.                     align: IconAlignmentType; iconID: INTEGER): OSErr;
  252.         INLINE $303C, $0613, $ABC9;
  253.  
  254.     FUNCTION IconSuiteToRgn(theRgn: RgnHandle; iconRect: Rect;
  255.                     align: IconAlignmentType;
  256.                     theIconSuite: Handle): OSErr;
  257.         INLINE $303C, $0714, $ABC9;
  258.  
  259.     FUNCTION IconMethodToRgn(theRgn: RgnHandle; iconRect: Rect;
  260.                     align: IconAlignmentType;
  261.                     theMethod: IconGetter; yourDataPtr: Ptr): OSErr;
  262.         INLINE $303C, $0915, $ABC9;
  263.  
  264.     FUNCTION SetSuiteLabel(theSuite: Handle; theLabel: INTEGER): OSErr;
  265.         INLINE $303C, $0316, $ABC9;
  266.  
  267.     FUNCTION GetSuiteLabel(theSuite: Handle): INTEGER;
  268.         INLINE $303C, $0217, $ABC9;
  269.  
  270.     FUNCTION GetIconCacheData(theCache: Handle; VAR theData: Ptr): OSErr;
  271.         INLINE $303C, $0419, $ABC9;
  272.         
  273.     FUNCTION SetIconCacheData(theCache: Handle; theData: Ptr): OSErr;
  274.         INLINE $303C, $041A, $ABC9;
  275.         
  276.     FUNCTION GetIconCacheProc(theCache: Handle; VAR theProc: IconGetter): OSErr;
  277.         INLINE $303C, $041B, $ABC9;
  278.         
  279.     FUNCTION SetIconCacheProc(theCache: Handle; theProc: IconGetter): OSErr;
  280.         INLINE $303C, $041C, $ABC9;
  281.  
  282.     FUNCTION PlotIconHandle(theRect: Rect; align: IconAlignmentType;
  283.                     transform: IconTransformType; theIcon: Handle): OSErr;
  284.         INLINE $303C, $061D, $ABC9;
  285.  
  286.     FUNCTION PlotSICNHandle(theRect: Rect; align: IconAlignmentType;
  287.                     transform: IconTransformType; theSICN: Handle): OSErr;
  288.         INLINE $303C, $061E, $ABC9;
  289.  
  290.     FUNCTION PlotCIconHandle(theRect: Rect; align: IconAlignmentType;
  291.                     transform: IconTransformType; theCIcon: CIconHandle): OSErr;
  292.         INLINE $303C, $061F, $ABC9;
  293.  
  294. {$ENDC} { UsingIcons }
  295.  
  296. {$IFC NOT UsingIncludes}
  297.  END.
  298. {$ENDC}
  299.  
  300.